# coding=utf-8
# __author__ = "James Zhang"
# !/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import os

import uis

DEBUG = True
SECRET_KEY = "3932030fdsakdfssk;ldsa112EADQC"
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_DIR = os.path.join(BASE_DIR, "static")
TEMPLATE_DIR = os.path.join(BASE_DIR, "templates")

UI_MODULES = uis.ui_modules     # UI
# HANDLES = urls.url_pattens      # urls

# 登录url
LOGIN_URL = '/account/login'
# Socket setting
IPV4_ONLY = True
XHEADERS = True  # 反向代理時獲取用戶真實的IP地址
DEFAULT_PORT = 8000
DEFAULT_HOST = '127.0.0.1'

DATABASE = {
    'default': {
        'backend': 'mysql',
        'host': '10.129.8.21',
        'port': 3306,
        'db': 'james_test1',
        'user': 'gps',
        'password': 'gps!@#',
        'charset': 'utf8',
    }
}

COOKIE = {
    'secret': 'g1TooU/tSlihfjCzHJJSoEPac0UlVkKCq4DByGYLtCE=',
    'csrf': False
}

USE_TZ = False

# A string like ".example.com", or None for standard domain cookie.
SESSION_COOKIE_DOMAIN = None
# Whether to save the session data on every request.
SESSION_SAVE_EVERY_REQUEST = False
SESSION_COOKIE_PATH = '/'
# Whether the session cookie should be secure (https:// only).
SESSION_COOKIE_SECURE = False
# Whether to use the non-RFC standard httpOnly flag (IE, FF3+, others)
SESSION_COOKIE_HTTPONLY = True


SESSION_ENGINE = 'core.sessions.backends.db'    # session引擎
SESSION_COOKIE_AGE = 120 * 60           # 存活时长为120秒*60
SESSION_EXPIRE_AT_BROWSER_CLOSE = True  # 当浏览器关闭时,session存活期即满并删除